package geovis.springcloud.demo.task;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.task.configuration.EnableTask;
import org.springframework.context.annotation.Bean;

import java.util.logging.Logger;

@SpringBootApplication
@EnableTask
public class TaskApplication {
    private static final Logger log = Logger.getLogger("TaskApplication");

    public static void main(String[] args) {
        SpringApplication.run(TaskApplication.class,args);
    }

    @Bean
    public TaskApplication.HelloWorldCommandLineRunner commandLineRunner() {
        return new HelloWorldCommandLineRunner();
    }

    public static class HelloWorldCommandLineRunner implements CommandLineRunner {

        @Override
        public void run(String... strings) throws Exception {
            log.info("running a task!!!!");
        }
    }
}
